package com.example.myapplication;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {


    String tag = "hello yx";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


//        Log.i(tag, "this one");
//
//
//        // <uses-permission android:name="android.permission.READ_PHONE_STATE" />
//
//        TestReceiver tmp = new TestReceiver();
//        IntentFilter intentFilter = new IntentFilter();
//        intentFilter.addAction("android.intent.action.PHONE_STATE");
//        registerReceiver(tmp, intentFilter);
//
//        Intent intent = new Intent();
//        intent.setAction("android.intent.action.PHONE_STATE");
//        PackageManager pm = getPackageManager();
//        List<ResolveInfo> resolveInfos = pm.queryBroadcastReceivers(intent, 0);
//        if(resolveInfos != null && !resolveInfos.isEmpty()) {
//            //查询到相应的BroadcastReceiver
//            Log.i(tag, "yes");
//        }else {
//            Log.i(tag, "no");
//        }
//
//        unregisterReceiver(tmp);


//        List<ResolveInfo> resolveInfos2 = pm.queryBroadcastReceivers(intent, 0);
//        if(resolveInfos2 != null && !resolveInfos2.isEmpty()) {
//            //查询到相应的BroadcastReceiver
//            Log.i(tag, "yes");
//        }else {
//            Log.i(tag, "no");
//        }


//        Log.i(Constants.LogTag, "this begin");
//        Intent in = new Intent(MainActivity.this, SecondActivity.class);
//        in.putExtra("stu", new Student(1, "张三"));
//        startActivity(in);


//        ContextIm

    }
}
